package file;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;

/**
 * Created with IntelliJ IDEA
 * Description：printWriter用法
 * User：chenshu
 * Date：2023-11-15
 * Time：23:00
 */
public class Demo6 {
    public static void main(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("test.txt")) {
            PrintWriter printWriter = new PrintWriter(outputStream);
            //自带缓冲区
            printWriter.println("hello");
            printWriter.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
